﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ClarkFirstCSharpProgram
{
    public partial class Form1 : Form
    {
        double amount = 0.0;
        String msg = "";
        double c = 0; 
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
        yes:
            {
                if (checkBox1.Checked)
                {
                    double a1sum = System.Double.Parse(textBox1.Text);
                    double b = a1sum * 91.30;
                    amount += b;
                    c = a1sum;
                    msg += (c + " A1-Value Meal\t\t " + "P" + b + "\n");
                }


                if (checkBox2.Checked)
                {
                    double a2sum = System.Double.Parse(textBox2.Text);
                    double b = a2sum * 110.00;
                    amount += b;
                    c = a2sum;
                    msg += (c + " A2-Value Meal\t\t " + "P" + b + "\n");
                }






                double txtsum = System.Double.Parse(textBox3.Text);
                double sum = txtsum - amount;
                if (txtsum > amount)
                {
                    MessageBox.Show("\t Jollibee Imus\n" + " ...............................\n\n\n" + msg + "\n" + "\t\t\t******\n" + "Amount Due:" + "\t\t " + "P" + sum.ToString("0.0") + "\n" + " Do you want to order again?\n\n\n", "Receipt", MessageBoxButtons.YesNo);
                    if (MessageBox.Show("Do you want to order again?", "Receipt", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                    {
                        checkBox1.Checked = false;
                        checkBox2.Checked = false;
                        
                        goto yes;
                    }
                    else
                    {
                        this.Close();
                    }
                }
                else if (textBox3.Equals(null))
                {
                    MessageBox.Show("Enter Amount");
                }
                else if (txtsum < amount)
                {
                    MessageBox.Show("Not Enough Money");
                }
                else
                {
                    this.Close();
                }


            }
        }
    }
}
